<template>
  <el-header class="w-10 h-10 d-flex jc-end ai-stretch" style="line-height: 70px;">
    <h1 class="text-left flex-1" style="color: #fff;">惠济区村(居)务监督平台 -- {{ mapObj[admin.mType] }}</h1>
    <el-dropdown @command="handleCommand">
      <i class="el-icon-setting" style="margin-right: 15px;font-size: 18px;"></i>
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item command="exit">退出登陆</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
    <span>{{ admin.mName }}</span>
  </el-header>
</template>

<script>
export default {
  data() {
    return {
      admin: {},
      mapObj: {'2':'区级管理平台','4':'镇,街道级管理平台','5':'村级管理平台'},
    };
  },
  methods: {
    handleCommand(command) {
      this.$confirm('即将跳转到登陆页面并推出登陆, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$message({
            type: 'success',
            message: '退出成功!'
          });
          this.$router.replace({ path: '/login' });
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消'
          });          
        });
    }
  },
  created() {
    this.admin = this.$util.handleLocalStorage("get", "admin");
  }
};
</script>
